﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WakeOnHan
{
    public partial class frmAddComputers : Form
    {
        frmWOH MainForm;
        // The constructor receives a reference to mainform.
        public frmAddComputers(frmWOH frmMain)
        {
            InitializeComponent();
            MainForm = frmMain;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            MainForm.clearWorkstationTable();
            string strippedLine = "";
            string[] lines = tbComputerList.Lines;
            for(int i=0; i < lines.Length;i++)
            {
                strippedLine = lines[i].Trim(new Char[] { ' ', '*', '.', ';', ':',',' });
                MainForm.addWorkstationToTable(strippedLine);
            }
            this.Close();
        }
    }
}
